function Contr() {
    this.people = new People();

    this.grameStart = function () {
        var roomNum = Math.round(9*Math.random());
        alert("第"+(roomNum+1)+"个房间");
        var com = prompt("选择敲门(knock)还是喂食(feed)? k or f");
        if(com.toString().includes("k")){
            this.people.knock(roomNum);
        }else if(com.toString().includes("f")){
            var com1 = prompt("喂老虎应该输入单词 meat，喂羊应该输入单词 grass!");
            this.people.feed(roomNum,com1);
        }
    }

    this.endGame = function () {
        var room = this.people.getRoom();
        room.getAllanimal();
    }
    
    this.endTime = function () {
        var date = new Date();
        var s = date.getSeconds();
        s += 1*10;
        return s;
    }
}

var contr = new Contr();
var num =1;
var end = contr.endTime();
while(1) {
    var run = new Date().getSeconds();
    if(run>end){
        break;
    }
    contr.grameStart();
}
alert("时间到！游戏结束！")
contr.endGame();